You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
913 B
28 lines
913 B
import { defineWrappedResponseHandler } from "#server/utils/handler";
|
|
import { R } from "#server/utils/response";
|
|
import { getCharacterCardBySlug } from "#server/service/character/character-card";
|
|
import { parseTags } from "#server/service/character/persona";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
const slug = getRouterParam(event, "slug");
|
|
if (!slug) {
|
|
return R.error("参数无效", null);
|
|
}
|
|
const card = await getCharacterCardBySlug(slug);
|
|
if (!card) {
|
|
return R.error("角色不存在", null);
|
|
}
|
|
return R.success({
|
|
id: card.id,
|
|
slug: card.slug,
|
|
name: card.name,
|
|
avatar: card.avatar,
|
|
description: card.description,
|
|
personality: card.personality,
|
|
scenario: card.scenario,
|
|
firstMessage: card.firstMessage,
|
|
exampleDialogue: card.exampleDialogue,
|
|
defaultModelId: card.defaultModelId,
|
|
tags: parseTags(card.tags),
|
|
});
|
|
});
|
|
|